home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / Documents / NeXTAnswers / appkit.827 < prev    next >
Text File  |  1992-02-06  |  3KB  |  94 lines

  1. {\rtf0\ansi{\fonttbl\f0\fnil Times-Roman;\f1\fmodern Courier;\f2\fswiss Helvetica;}
  2. \paperw13040
  3. \paperh10800
  4. \margl120
  5. \margr120
  6. {\colortbl\red0\green0\blue0;}
  7. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\b0\i0\ul0\fs28 bug workaround NXBrowser subclass lazy \
  8. \
  9.  
  10. \fi-420\li420 Q:  I've implemented a subclass of NXBrowser and have created a delegate for that browser which is lazy.  However I have discovered that the  
  11. \b browser: loadCell: atRow: inColumn:
  12. \b0   method is not being called!  This problem does not occur for a standard NXBrowser.  What am I doing wrong?\
  13.  
  14. \fi0\li0 \
  15.  
  16. \fi-420\li420 A:  This is a known bug and it will occur both for lazy browsers and for very lazy browsers.   You can workaround this bug by subclassing NXBrowserCell and overriding the following methods:
  17. \fi0\li0 \
  18.  
  19. \pard\tx620\tx1240\tx1860\tx2480\tx3100\tx3720\tx4340\tx4980\tx5600\tx6220\f1\fs24\fc0 \
  20.     #import "FooBrowserCell.h"\
  21.     #import <appkit/Matrix.h>\
  22.     #import <appkit/NXBrowser.h>\
  23.     \
  24.     @implementation FooBrowserCell\
  25.     \
  26.     - drawInside:(const NXRect *)cellFrame inView:controlView\
  27.     \{\
  28.     \
  29.         id theBrowserDelegate;\
  30.         int     row, col;\
  31.         \
  32.         if (![self isLoaded])\
  33.         \{\
  34.             // controlView is the matrix\
  35.             // the superview is the clipView\
  36.             // the superview of the clipView is the scrollView\
  37.             // the superview of the scrollView is the browser\
  38.             theBrowserDelegate = \
  39.                 [[[[controlView superview] superview] superview] delegate];\
  40.             [controlView getRow: &row andCol: &col ofCell:self];\
  41.             [theBrowserDelegate browser:nil loadCell:self atRow:row  inColumn: col];\
  42.         \}\
  43.         \
  44.         return [super drawInside: cellFrame inView: controlView];\
  45.     \}\
  46.     \
  47.     \
  48.     - highlight:(const NXRect *)cellFrame inView:controlView lit:(BOOL)lit\
  49.     \{\
  50.     \
  51.         id theBrowserDelegate;\
  52.         int     row, col;\
  53.         \
  54.         if (![self isLoaded])\
  55.         \{\
  56.             // controlView is the matrix\
  57.             // the superview is the clipView\
  58.             // the superview of the clipView is the scrollView\
  59.             // the superview of the scrollView is the browser\
  60.             theBrowserDelegate = \
  61.                 [[[[controlView superview] superview] superview] delegate];\
  62.             [controlView getRow: &row andCol: &col ofCell:self];\
  63.             [theBrowserDelegate browser:nil loadCell:self atRow:row  inColumn: col];\
  64.         \}\
  65.         \
  66.         return [super highlight: cellFrame  inView: controlView  lit: lit];\
  67.     \}\
  68.     \
  69.     \
  70.     @end\
  71.  
  72. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\fs28 \
  73. \
  74. You must also override the 
  75. \b initFrame:
  76. \b0  method in your NXBrowser subclass in order to set the new cell class:\
  77. \
  78.  
  79. \pard\tx620\tx1240\tx1860\tx2480\tx3100\tx3720\tx4340\tx4980\tx5600\tx6220\f1\fs24\fc0     - initFrame:(const NXRect *)frameRect\
  80.     \{\
  81.         [super initFrame: frameRect];\
  82.         [self setCellClass: [FooBrowserCell class]];\
  83.         return self;\
  84.     \}\
  85.  
  86. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\fs28\fc0 \
  87. \
  88. QA827\
  89. \
  90. Valid for 1.0\
  91. Valid for 2.0\
  92. \
  93.  
  94.